Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest) : Endpoint for export SBOM at project detail page #2950

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Farooq-Fateh-Aftab
Copy link

@Farooq-Fateh-Aftab Farooq-Fateh-Aftab commented Mar 4, 2025

Please provide a summary of your changes here.

Closes: #2858

Suggest Reviewer

You can suggest reviewers here with an @mention.

How To Test?

Request Type : get
bomType : json or xml
withSubProject : true or false
module= sbom
projectId : project id

url:
http://localhost:8080/resource/api/reports?module=sbom&projectId=c2b4ced4c19ebb07d63039c5d501800a&withSubProject=true&bomType=json

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@Farooq-Fateh-Aftab Farooq-Fateh-Aftab force-pushed the feat/exportSbomProjectDetail branch from fff9a51 to 509b2b0 Compare March 4, 2025 10:02
@GMishx GMishx marked this pull request as ready for review March 6, 2025 09:46
@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 6, 2025
Comment on lines +450 to +456
if (RequestStatus.FAILED_SANITY_CHECK.equals(status)) {
bomString = "{\"status\": \"" + status.name() + "\"}";
} else if (RequestStatus.ACCESS_DENIED.equals(status)) {
bomString = "{\"status\": \"" + status.name() + "\", \"message\": \"" + SW360Constants.SBOM_IMPORT_EXPORT_ACCESS_USER_ROLE + "\"}";
} else if (RequestStatus.FAILURE.equals(status)) {
bomString = "{\"status\": \"" + status.name() + "\", \"message\": \"" + summary.getMessage() + "\"}";
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These states should cause an exception and not return a JSON with a normal 200 response code. Please throw appropriate exceptions based on the failure state.

Otherwise, as of now, I will get a JSON saying {"status": "ACCESS_DENIED", "message": "..."} and will assume it is a CDX SBOM unless I open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review needs general test This is general testing, meaning that there is no org specific issue to check for priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New rest endpoint for Export SBOM at project detail page
3 participants